//加工入库结算
import service from '@/utils/request'
// eslint-disable-next-line no-unused-vars
const { httpPostForm, httpPost, httpGet } = service
// import { selectDataClient } from '@/utils/common'
import { selectDataClient } from '@/utils/common'
const request = {
    //获取table页面列表
    getpaymentList (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/listByEntity',
            params
        })
    },
    //新增加工个入库结算
    addjgrk (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/create',
            params
        })
    },
    //更新加工费
    updatejgf (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/updateProcessCostList',
            params
        })
    },
    //更新成品物资
    updatecpwz (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/updateFinishedGoodsList',
            params
        })
    },
    //更新原物资
    updateywz (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/updateMaterialsList',
            params
        })
    },
    //更新服务费用
    updatefwfy (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/updateServiceFeeList',
            params
        })
    },
    //更新保证金
    udatebzj (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/updateReturnDepositList',
            params
        })
    },
    //修改加工入库结算
    updatejgrk (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/update',
            params
        })
    },
    //删除加工入库 物理删除
    deletewljgrk (params) {
        return httpPost({
            url: '/materialsettle/processingReceiptSettlement/realDelete',
            params
        })
    },
    //根据id 删除加工入库
    deletejgrk (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/delete',
            params
        })
    },
    //根据加工入库结算id查询加工入库结算基础信息
    getjgrk (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/findById',
            params
        })
    },
    //根据id获取加工费明细
    getjgf (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/getProcessCostListById',
            params
        })
    },
    //根据id获取成品物资
    getcpwz (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/getFinishedGoodsListById',
            params
        })
    },
    //根据id 获取原物资
    getywz (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/getMaterialsListById',
            params
        })
    },
    //根据id 获取 服务费用
    getfwfy (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/getServiceFeeListById',
            params
        })
    },
    //根据id 获取 保证金
    getbzj (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/getReturnDepositDtlListById',
            params
        })
    },
    //获取加工费验收接口
    getjgflist (params) {
        return httpPost({
            url: '/materialsettle/processingAcceptance/listProcessCostForSelect',
            params
        })
    },
    // 获取价差列表
    getSpread (billId) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/listPriceDifference',
            params: {
                billId
            }
        })
    },
    // 获取剩余预付款金额
    getRemainingPrepaymentAmount (params) {
        return httpGet({
            url: '/materialsettle/supplierPrepaymentSettlement/getAdvancePaymentAmount',
            params
        })
    },
    // 获取截止上期末的累计结算金额
    getCumulativeSettlementAmount (params) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/getPreviousTotalAmount',
            params
        })
    },
    // 物资验收-服务费用:选择合同
    getContract (orgId, contracted) {
        return  selectDataClient({
            SelectServiceToken: '/subcontract/thirdParty/getMachiningAcceptance', // 客户端对应方法名
            IsSingleMode: true, // 是否单选 true 单选 false 多选
            SelectedIDs: [JSON.stringify(contracted)], // 已选中id(注意：是上一次已选中的id，不是要传的参数，如果第一次选，则传[]) // 这个是客户端给的,没有则为空
            InitParamsStr: JSON.stringify(orgId),    // 接口参数(name为模拟参数)
            Title: '选择合同' // 标题
        }).then(res => {
            return res[0]
        })
    },
    // 物资验收-服务费用:选择结算单位
    getBillingUnit (data, ids) {
        return selectDataClient({
            SelectServiceToken: 'GeneralSelectOuter', // 客户端对应方法名
            IsSingleMode: true, // 是否单选 true 单选 false 多选
            SelectedIDs: [ids], // 已选中id(注意：是上一次已选中的id，不是要传的参数，如果第一次选，则传[]) // 这个是客户端给的,没有则为空
            InitParamsStr: JSON.stringify(data),    // 接口参数(name为模拟参数)
            Title: '选择结算单位' // 标题
        }).then(res => {
            return res[0]
        })
    },
    //获取原物资明细
    getywzlist (params) {
        return httpPost({
            url: '/materialsettle/processingAcceptance/listProcessingAcceptanceMaterialsForSelect',
            params
        })
    },
    //弹窗接口 测试
    tanchuang (params) {
        return httpGet({
            url: '/materialsettle/processingAcceptance/listUnsettleFinishedGoodsForSelect',
            params
        })
    },
    // 冲红单
    redSingle (billId) {
        return httpGet({
            url: '/materialsettle/processingReceiptSettlement/initRedBill',
            params: {
                billId
            }
        })
    },

}

export default request
